package com.activiti.listeners;

import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.delegate.TaskListener;
/**
 * 流程监听器和任务监听器示例
 * @author 0380009081
 *
 */
public class VacationListener implements TaskListener,ExecutionListener {

	private static final long serialVersionUID = 1L;

	/**
	 * 任务监听器，如用户任务
	 */
	@Override
	public void notify(DelegateTask delegateTask) {
		String eventName = delegateTask.getName();
		// start
		System.out.println("任务监听器---------");
		if ("提交申请".equals(eventName)) {
			System.out.println("提交申请=========");
		} else if ("经理审批".equals(eventName)) {
			System.out.println("经理审批=========");
		} else if ("总监审批".equals(eventName)) {
			System.out.println("总监审批=========");
		}
	}

	/**
	 * 流程监听器，如开始，结束节点
	 */
	@Override
	public void notify(DelegateExecution execution) {
		String eventName = execution.getEventName();
				// start
				System.out.println("流程监听器---------");
				if ("Start".equals(eventName)) {
					System.out.println("start=========");
				} else if ("End".equals(eventName)) {
					System.out.println("end=========");
				}
	}

}
